<?php
if($this->styleForm === NULL)
	include BXD_INCLUDEPATH . 'components/tools/form/style/default.php';

if($this->showError && !$this->showCustomError)
	echo '<div id="errorForm' . ucfirst($param['NAME']) . '" class="listErrorForm"></div>';
?>

<script type="text/javascript">
	function submitForm<?= ucfirst($param['NAME']); ?>()
	{
		$('#errorForm<?= ucfirst($param['NAME']); ?>').html("<div class='loading'>Attendere prego...</div>");
		
		$.<?= $param['METHOD'] == "post" ? "post" : "get" ?>('<?= $param['ACTION'] ?>', $("form[name=<?= $param['NAME'] ?>]").serialize(), function(html){
			if(html != "")
			{
				<?php
				if($this->showError)
					echo '$("#errorForm' . ucfirst($param['NAME']) . '").html(html);';
				?>
			}
			else
			{
				<?php
				if($this->showError)
					echo '$("#errorForm' . ucfirst($param['NAME']) . '").html("");';

				if(is_string($param['DIALOG_BOX']))
					echo '$("#' . $param['DIALOG_BOX'] . '").dialog("close").html("");';
				
				if(is_string($param['CALLBACK_FUNCTION']))
					echo $param['CALLBACK_FUNCTION'] . "();";
				?>
			}
		}, "html");
	}
	function resetForm<?= ucfirst($param['NAME']); ?>()
	{
		$("form[name=<?= $param['NAME'] ?>]")[0].reset();
	}
</script>

<form class="<?= $this->styleForm !== NULL ? $this->styleForm : '' ?>" name="<?= $param['NAME'] ?>" action="javascript:submitForm<?= ucfirst($param['NAME']); ?>()">